<div id="container">
<div id="sidebar">
	<div class="logo"><a href="<?=site_url()?>"><img src="<?=base_url()?>resources/imgs/logo.png" alt="" width="200"></a><p class="sub-title">Traiteur Chinois</p></div>
		<div class="submenu" >
<h3><a href="<?=site_url('account')?>">Mes Commandes</a></h3><br>
<h3><a href="<?=site_url('account/address')?>">Adresses Livraisons</a></h3><br>
<h3><a href="<?=site_url('account/update_password')?>">Mot de Passe</a></h3><br>
<hr>
</div>
		<h3>
			<img src="<?=base_url()?>/resources/imgs/cart.png" alt="Panier" title="Panier" height="16"> Panier
			<?=$this->cart->total_items()?>
			|
			<?=number_format($this->cart->total(),2,'.','')?>
			€
		</h3>
		
		<?php $i = 1; ?>
		<?php if(!$this->cart->contents()){?>
		<p>
			Panier Vide
		</p>
		<?php }?>

		<?php foreach ($this->cart->contents() as $items): ?>
		<div class="order_item">
			<span class="product_item"> 
			<?=$items['product_num']?>.<?=nbs(0)?> <?php echo $items['name']; ?>
			</span> <span class="qty"><?php if($items['options_price'] !=NULL && $items['options_price'] != 0){?> <?=number_format($items['price']+$items['options_price'],2,'.','')?> € (<?=$items['qty']?>)<?php }else{?> <?=number_format($items['price'],2,'.','')?> € (<?=$items['qty']?>)<?php }?></span>
			<br><span class="option"><?php if($this->cart->has_options($items['rowid'])==TRUE):?><label><small>OPTIONs:	</small></label><?php foreach ($this->cart->product_options($items['rowid']) as $option): ?><?=nbs(1)?>

					<small><?php echo $option['option_name']; ?> <?php if( $option['price'] !=NULL ){ echo ': '.$option['price'].' €';} ?></small><?=nbs(1)?>

					<?php endforeach; ?><?php endif; ?></span>
			<div class="clear"></div>

		</div>
		<?php $i++; ?>
		<?php endforeach; ?>
		<div class="clear"></div>
		<br><br>
		<input class="btn_panier" type="button" value="MON PANIER" onclick="document.location.href='<?=site_url('cart')?>'">
		<hr>
		<?php if($this->discount || $this->discount_delivery){?>
		<h3>Promo!</h3>
		<?php if($this->discount){?>
	<div class="promo">
	A partir du <?=date('d M. Y',strtotime($this->discount[0]->discount_start))?> jusqu'au <?=date('d M. Y',strtotime($this->discount[0]->discount_end))?>, Une Réduction de <?=$this->discount[0]->discount_val*100?>% pour toutes les commandes paiement par espèces !!!
	</div>
	<?php }?>
	<?php if($this->discount_delivery){?>
	<div class="promo">
	A partir du <?=date('d M. Y',strtotime($this->discount_delivery[0]->discount_start))?> jusqu'au <?=date('d M. Y',strtotime($this->discount_delivery[0]->discount_end))?>,  Pour les commandes de livraison, Une Réduction de <?=$this->discount_delivery[0]->discount_val*100?>% 
	pour les communes: <br>
	<?php foreach ($this->discount_delivery[0]->community as $c):?>
	<?=$c->code?> <?=$c->name?> / 
	<?php endforeach;?>
	!!!</div>
	<?php }?>
	<?php }?>
	
		
	</div>
	<div class="rightbar">
<div class="ctn_account">

<div class="orders_info">
<b>Ma dernière commande</b>
<hr>

<?php if($order !=NULL){?>
<table width="100%">
<tr style="background: #eee;">
<th width="5%">Num</th>
<th width="60%">Article</th>
<th width="10%">Prix</th>
<th width="5%">QTY</th>
<th width="10%">Sous-Total</th>
</tr>
<?php foreach ($orderitem as $item):?>
<tr class="border_bottom">
<td><?=$item->product_num?>.</td>
<td><?=$item->product_name?></td>
<td><?=number_format($item->product_price,2,'.','')?> €</td>
<td><?=$item->qty?></td>
<td style="text-align: right;"><?php echo number_format(($item->product_price+$item->additional_price)*$item->qty,2,'.','')?> €</td>
</tr>
<?php if($item->option){?><?php echo '<tr  class="border_bottom"><td><label>OPTIONs:</label> </td><td>'.$item->option.'</td></tr>' ; }?>
<?php endforeach;?>
</table>
<br>
<h4>Réduction:&nbsp;&nbsp;<?=$order[0]->discount*100?> %</h4>

<?php if($order[0]->extra !=0):?>
<h4>Supplément:&nbsp;&nbsp;<?=number_format($order[0]->extra,1,'.','')?> €</h4>
<?php endif;?>

<div class="total"><span>Total:&nbsp;&nbsp;<?=number_format($order[0]->total*(1-$order[0]->discount)+$order[0]->extra,1,'.','')?> </span></div>

<hr>
<div class="left">
Heure de commande: <?=$order[0]->order_time->format('short')?><br><br>
<?php if($order[0]->reservation !=NULL){?> 
<h4><img src="<?=base_url()?>/resources/imgs/calendar.png"/ > Réservation : <?=$order[0]->reservation?></h4>
<?php }else{?>
<h4><img src="<?=base_url()?>/resources/imgs/flash.png" height="18"/> Commande Normale: <?=date('d-M-Y')?></h4>
<?php }?>
</div>
<div class="right">
<?php if($order[0]->order_type == 'delivery'):?>
<img src="<?=base_url()?>/resources/imgs/car.png" height="20" /> <span class="txt_highlight">Livraison: <?=$order[0]->delivery_time?></span><br><br>


Sonnette: <?=$address->ring?><br><br>
Adresse: <?=$address->house_num?> <?=$address->address?><br><br>
Commune: <?=$address->postal?> <?=$address->community?><br><br>
Téléphone: <?=$address->tele?><br><br>
<?php endif;?>
<?php if($order[0]->order_type == 'take away'):?>
-<img src="<?=base_url()?>/resources/imgs/bag.png" height="13"/>- <b>Magazin à emporter <br><br><?=$order[0]->shop->shop_name?></b><br>
<b><?=$order[0]->shop->address?></b><br><br>
<b>télé: <?=$order[0]->shop->tele?></b><br><br>
<span class="txt_highlight">Heure à emporter <?=$order[0]->takeaway_time?></span><br><br>
Nom: <?=$order[0]->member->firstname?> <?=$order[0]->member->lastname?><br>
Téléphone: <?=$order[0]->member->tel?><br><br>

<?php endif;?>
Message:<br>
<?=$order[0]->message?>
</div>
<?php }else{?>
<br>
Vous n'avez pas de commande.<br><br>
<input type="button" class="button" value="faites votre première commande ?" onclick="window.location.href='<?=site_url('menu')?>';"/>
<?php }?>

</div>
<div class="clear"></div>
</div>
</div>
<div class="clear"></div>
</div>
</div>